package org.jrfe.math;

import org.jrfe.util.FastMath;

public class Transform2D {

	float rotate;
	float cosAngle;
	float sinAngle;
	
	public Transform2D() {
		rotate = 0;
	}
	
	public void add(Transform2D t){
		rotate += t.getRotate();
		setRotate(rotate);
	}
	
	public void setTo(Transform2D t){
		rotate = t.getRotate();
		cosAngle = t.getCosAngle();
		sinAngle = t.getSinAngle();
	}
	
	public void addRotate(float r){
		rotate += r;
				
		setRotate(rotate);
	}
	
	public void reset(){
		rotate = 0.0f;
	}
	
	public void setRotate(float rotate) {
		this.rotate = rotate;
		cosAngle = FastMath.cos(rotate);
		sinAngle = FastMath.sin(rotate);
	}

	public float getRotate() {
		return rotate;
	}
	
	public float getCosAngle() {
		return cosAngle;
	}

	public void setCosAngle(float cosAngle) {
		this.cosAngle = cosAngle;
	}


	public float getSinAngle() {
		return sinAngle;
	}


	public void setSinAngle(float sinAngle) {
		this.sinAngle = sinAngle;
	}
	
}
